/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commands;

import java.util.logging.Level;
import java.util.logging.Logger;
import servidorped.Conexion;
import servidorped.User;
import servidorped.UserListFactory;

/**
 *
 * @author Micosil
 */
public class disconnect implements Command {

    @Override
    public boolean execute(String[] stringlist, User user) {
        if (user.getUserName() != null) {            
            user.closeConnection();
            Logger.getGlobal().log(Level.INFO, "User {0} disconnected.", user.getUserName());
            UserListFactory.getList().disconnectUser(user);
        }
        return true;

    }
}
